<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<script>
			// 列出1~10000的所有质数。

			for (var i = 1; i <= 10000; i++) {
				var imax = parseInt(Math.sqrt(i))
				var flag = true
				for (var j = 2; j <= imax; j++) {
					if (i % j === 0) flag = false
        }
        if (i === 1) flag = false
				if (flag) console.log(i)
			}
		</script>
	</body>
</html>
